import { useDetail, useList } from "@/hooks";
import { getUserInfoUrl } from "@/command/apiTool";
import { getAction, postAction } from "@/command/netTool";
import * as vant from "vant";
const { showFailToast, showSuccessToast } = vant;
import { useRoute, useRouter } from "vue-router";
export const useRequest = () => {
  const router = useRouter();
  const route = useRoute();
  const confirm = (params: any) => {
    let queruParams = {
      ...params,
      brandId: route.query.id,
    };
    console.log("eee", queruParams);
    postAction(
      "/api/H5/sell/brand/small/apply",
      { ...queruParams },
      { isResolve: true }
    ).then((e) => {
      // showSuccessToast(e.msg)
      router.push("/applicationSuccess");
    });
  };
  const [productList] = useDetail("/api/H5/util/getProductLevel", []);
  const [packingList] = useDetail(
    "/api/H5/util/getDictType?dictType=pack_type",
    []
  );

  return {
    confirm,
    productList,
    packingList,
  };
};
